import { BaseRegionCode } from '../config/geoserver';
import request from '/@/utils/request';
import { BaseAppCode } from '/@/config/geoserver';

/**
 * 获取指定父级区域的下级区域列表
 * /res/region/list
 */
export function regionList(regionCode = BaseRegionCode.value) {
	return request({
		url: '/res/region/list',
		method: 'GET',
		params: { parentRegionCode: regionCode, includeGeom: 0,tenantId:1 },
	});
}

/**
 * 获取区域交换信息
 * @param {*} regionCode
 * @returns
 */
export function regionListInfo(data: any) {
	return request({
		url: `/res/region/feign/getSwapRegionInfo`,
		method: 'POST',
		data:Object.assign(data,{tenantId:1})
	});
}

/**
 * 发送短信
 * @param {*} params
 * @returns
 */
export function sendSms(params: any) {
	return request({
		url: `api/sms/sendCaptcha`,
		method: 'post',
		params,
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded',
		},
	});
}

/**
 * 图片上传
 * @param {*} data
 * @returns
 */
export function uploadFile(data: any) {
	return request({
		url: '/api/file/upload',
		method: 'POST',
		headers: {
			'Content-Type': 'multipart/form-data',
		},
		data,
	});
}
/**
 * 未登录 图片上传
 * @param data 
 * @returns 
 */
export function uploadFileOutlogin(data:any) {
	return request({
		url: '/api/file/uploadOutLogin',
		method: 'POST',
		headers: {
			'Content-Type': 'multipart/form-data',
		},
		data,
	});
}

/**
 * 获取应用设备accessToken
 */
export function getDeviceAccessToken() {
	return request({
		url: `/iot/lotapp/getAccessToken`,
		method: 'get',
		params: { appId: 'dfcy',secret:'dfcy'},
	});
}

/**
 * 获取公共参数
 * @param key 
 * @returns 
 */
export function getPublikParam(key){
	return request({
		url:'/admin/param/publicValue/'+key
	})
}